package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.result.PageData;
import com.whfc.emp.dto.AppTrainingDTO;
import com.whfc.emp.dto.AppTrainingQuestionsDTO;
import com.whfc.emp.param.*;
import com.whfc.emp.service.AppTrainingQuestionsOptionsService;
import com.whfc.emp.service.AppTrainingQuestionsService;
import com.whfc.emp.service.AppTrainingService;
import com.whfc.ms.api.emp.service.MsTrainingQuestionsService;
import com.whfc.ms.api.emp.service.MsTrainingService;
import io.jsonwebtoken.lang.Collections;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;


/**
 * @ClasssName MsTrainServiceImpl
 * @Description 人员管理-培训
 * @Author hw
 * @Date 2020/11/26 17:24
 * @Version 1.0
 */
@Service
public class MsTrainingQuestionsServiceImpl implements MsTrainingQuestionsService {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @DubboReference(interfaceClass = AppTrainingQuestionsService.class, version = "1.0.0", timeout = 5000)
    private AppTrainingQuestionsService appTrainingQuestionsService ;
//    @DubboReference(interfaceClass = AppTrainingQuestionsOptionsService.class, version = "1.0.0", timeout = 5000)


    @Override
    public PageData<AppTrainingQuestionsDTO> list(AppTrainingQuestionListParam request) {
        PageData<AppTrainingQuestionsDTO> pageData = appTrainingQuestionsService.list(request);
        if(Collections.isEmpty(pageData.getList())){
            return pageData;
        }

        pageData.getList().forEach(item -> {
            item.setOptions(null);
        });
        return pageData;
    }

    @Override
    public void add(AppTrainingQuestionAddParam request) {
        appTrainingQuestionsService.add(request);
    }

    @Override
    public void edit(AppTrainingQuestionEditParam request) {
        appTrainingQuestionsService.edit(request);
    }

    @Override
    public void del(Integer id) {
        appTrainingQuestionsService.del(id);
    }




}
